import {BaseController} from 'egg-cool-controller';
import router from 'egg-cool-router';

/**
 * 商品-商品
 */
@router.prefix ('/admin/goods/product' , ['add' , 'delete' , 'update' , 'info' , 'list' , 'page'])
export default class GoodsProductController extends BaseController {
    init () {
        this.setEntity (this.ctx.repo.goods.Product);
        this.setService (this.service.goods.product);
    }

    /**
     * 移动分类
     */
    @router.post ('/move')
    async move () {
        await this.OpService.move (this.getBody ());
        this.res ();
    }

    /**
     * 媒介
     */
    @router.get ('/medias')
    async medias () {
        this.res ({data : await this.OpService.medias (this.getQuery ())});
    }

    // undercarriage
    /**
     * 移动分类
     */
    @router.post ('/undercarriage')
    async undercarriage () {
        await this.OpService.undercarriage (this.getBody ());
        this.res ();
    }

    //上架 grounding
    @router.post ('/grounding')
    async grounding () {
        await this.OpService.grounding (this.getBody ());
        this.res ();
    }
}
